package com.design;

import com.design.entity.PayReq;
import com.design.service.AliPayService;
import com.design.service.JdPayService;
import com.design.service.WeixinPayService;

import java.math.BigDecimal;

class DesignFactoryMin {

    public void pay(PayReq payReq){
        //阿里支付
        if("1".equals(payReq.getPayType())){
            AliPayService aliPayService=new AliPayService();
            aliPayService.aliPay(payReq);
            //京东白条支付
        }else if ("2".equals(payReq.getPayType())){
            JdPayService jdPayService=new JdPayService();
            jdPayService.jdPay(payReq);
            //微信支付
        } else if ("3".equals(payReq.getPayType())) {
            WeixinPayService weixinPayService=new WeixinPayService();
            weixinPayService.weixinPay(payReq);
        }
    }

    public static void main(String[] args) {
        PayReq payReq=new PayReq();
        payReq.setPayType("1");
        payReq.setPayId("1001");
        payReq.setMoney(new BigDecimal("100"));
        DesignFactoryMin designFactoryMin =new DesignFactoryMin();
        designFactoryMin.pay(payReq);
    }

}
